package com.ihr360.oneclick.entity;

import com.alibaba.fastjson.JSONArray;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 电子表格表头列模型
 *
 * @author tom
 * @date 17-12-20
 */
public class RowHeaderColumn implements Serializable{

    public static class ColumnType {
        public static final  int STRING = 1;
        public static final  int NUMB = 2;
        public static final  int SELECT = 3;
        public static final  int DATE = 4;
    }

    public RowHeaderColumn() {
    }

    public RowHeaderColumn(String columnFieldMeta, String columnFieldName, String columnDisplayName, int columnType,
                           String columni8nKey, Boolean required, Boolean fixedColumn, int columnIndex) {
        this.columnFieldMeta = columnFieldMeta;
        this.columnFieldName = columnFieldName;
        this.columnDisplayName = columnDisplayName;
        this.columnType = columnType;
        this.columni8nKey = columni8nKey;
        this.required = required;
        this.fixedColumn = fixedColumn;
        this.columnIndex = columnIndex;
    }

    public RowHeaderColumn(String columnFieldName, String columnDisplayName, int columnType, Boolean fixedColumn) {
        this.columnFieldName = columnFieldName;
        this.columnDisplayName = columnDisplayName;
        this.columnType = columnType;
        this.fixedColumn = fixedColumn;
    }

    /**
     * 固定字段别名
     */
    private String[] columnAliasName;

    private String columnFieldMeta;

    /**
     * 标记为哪一个固定列
     */
    private String columnFieldName;

    /**
     * 列的名称
     */
    private String columnDisplayName;

    /**
     * 列的类型
     */
    private int columnType;

    /**
     * 国际化键
     */
    private String columni8nKey;

    /**
     * 是否是必填项
     */
    private Boolean required;

    /**
     * 是否为固定项
     */
    private Boolean fixedColumn;

    /**
     * 列在表格中的位置
     */
    private int columnIndex;

    /**
     * 是否允许修改
     */
    private Boolean update;

    public String[] getColumnAliasName() {
        return columnAliasName;
    }

    public void setColumnAliasName(String[] columnAliasName) {
        this.columnAliasName = columnAliasName;
    }

    public String getColumnFieldMeta() {
        return columnFieldMeta;
    }

    public void setColumnFieldMeta(String columnFieldMeta) {
        this.columnFieldMeta = columnFieldMeta;
    }

    public String getColumnFieldName() {
        return columnFieldName;
    }

    public void setColumnFieldName(String columnFieldName) {
        this.columnFieldName = columnFieldName;
    }

    public String getColumnDisplayName() {
        return columnDisplayName;
    }

    public void setColumnDisplayName(String columnDisplayName) {
        this.columnDisplayName = columnDisplayName;
    }

    public int getColumnType() {
        return columnType;
    }

    public void setColumnType(int columnType) {
        this.columnType = columnType;
    }

    public String getColumni8nKey() {
        return columni8nKey;
    }

    public void setColumni8nKey(String columni8nKey) {
        this.columni8nKey = columni8nKey;
    }

    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Boolean getFixedColumn() {
        return fixedColumn;
    }

    public void setFixedColumn(Boolean fixedColumn) {
        this.fixedColumn = fixedColumn;
    }

    public int getColumnIndex() {
        return columnIndex;
    }

    public void setColumnIndex(int columnIndex) {
        this.columnIndex = columnIndex;
    }

    public boolean isFixedColumn() {
        return fixedColumn != null && fixedColumn;
    }

    public void setFixedColumn(boolean fixedColumn) {
        this.fixedColumn = fixedColumn;
    }

    public Boolean getUpdate() {
        return update;
    }

    public void setUpdate(Boolean update) {
        this.update = update;
    }

    public static void main(String[] args) {
        // 固定字段： 姓名、证件类型、证件号码、手机号码、所属月份、入职日期、是否允许发布、发布状态
        RowHeaderColumn column1 = new RowHeaderColumn("staffName", "fixedColumn1", "姓名", 1, "onclick.term.staff.name", true, true, 0);
        RowHeaderColumn column2 = new RowHeaderColumn("idCardType", "fixedColumn2", "证件类型", 3, "onclick.term.staff.idCard.type", true, true, 1);
        RowHeaderColumn column3 = new RowHeaderColumn("idCardNo", "fixedColumn3", "证件号码", 1, "onclick.term.staff.idCard.no", true, true, 2);
        RowHeaderColumn column4 = new RowHeaderColumn("mobileNo", "fixedColumn4", "手机号码", 1, "onclick.term.staff.mobile.no", true, true, 3);
        RowHeaderColumn column5 = new RowHeaderColumn("month", "fixedColumn5", "所属月份", 4, "onclick.term.month", true, true, 4);
        RowHeaderColumn column6 = new RowHeaderColumn("entryDate", "fixedColumn6", "入职日期", 4, "onclick.term.entry.date", true, true, 5);
        RowHeaderColumn column7 = new RowHeaderColumn("allowPublish", "fixedColumn7", "是否允许发布", 2, "onclick.term.allow.publish", true, true, 6);

        List<RowHeaderColumn> list = new ArrayList<>();
        list.add(column1);
        list.add(column2);
        list.add(column3);
        list.add(column4);
        list.add(column5);
        list.add(column6);
        list.add(column7);
        System.out.println(JSONArray.toJSONString(list));
    }
}
